<div class="row-content am-cf">
	<div class="row">
		<div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
			<div class="widget am-cf">
				<div class="widget-head am-cf">
					<div class="widget-title am-fl">新增角色</div>
					<div class="widget-function am-fr">
						<a href="javascript:;" class="am-icon-cog"></a>
					</div>
				</div>
				<div class="widget-body am-fr">
					<form class="am-form tpl-form-line-form" id="roleForm" method="post">
					<div class="am-form-group"  id="parentDiv">
							<label for="parentId" class="am-u-sm-2 am-form-label">所属部门</label>
							<div class="am-u-sm-3" style="float:left">
								 <div class="am-input-group">
							     <input type="text"  class="am-form-field" placeholder="请选择部门" id="pname" name="deptName" readonly="readonly" /> 
							     <span class="am-input-group-btn">
							        <button class="am-btn am-btn-default" id="menuBtn" type="button"><span class="am-icon-search"></span> </button>
							      </span>
							    </div>
								<input type="hidden"  id="pid" name="deptId" /> 
							</div>
						</div>
						<div class="am-form-group">
							<label for="account" class="am-u-sm-2 am-form-label">角色名称
								<span class="tpl-form-line-small-title">RoleName</span>
							</label>
							<div class="am-u-sm-10">
								<input type="text" id="account" class="tpl-form-input" placeholder="请输入角色名称" name="name" /> 
							</div>
						</div>
						<div class="am-form-group">
							<label for="password" class="am-u-sm-2 am-form-label">角色标识
								<span class="tpl-form-line-small-title">RoleKey</span>
							</label>
							<div class="am-u-sm-10">
								<input type="text" id="password" class="tpl-form-input" placeholder="请输入角色标识" name="key" /> 
							</div>
						</div>
						
						<div class="am-form-group">
							<label for="repassword" class="am-u-sm-2 am-form-label">描述
								<span class="tpl-form-line-small-title">Description</span>
							</label>
							<div class="am-u-sm-10">
								<input type="text" id="repassword" class="tpl-form-input" placeholder="请输入描述" name="description" /> 
							</div>
						</div>
						

						<div class="am-form-group">
							<div class="am-u-sm-10 am-u-sm-push-2">
								
								<button type="button" onclick="javascript:$('#roleForm').submit();"
									class="am-btn am-btn-primary tpl-btn-bg-color-success ">提交</button>
										<button type="button" onclick="loadPage('role/listUI')"
									class="am-btn am-btn-success tpl-btn-bg-color-success ">返回</button>
							</div>
						</div>
					</form>
				</div>
			</div>
		</div>
	</div>

	</div>
	<script th:inline="javascript">
	<![CDATA[
	//$('select').selected();
	validateUserForm();
	openDeptTree();
	function validateUserForm(){    
	    $('#roleForm').validate({
	        errorElement : 'span',
	        errorClass : 'am-icon-times',
	        focusInvalid : true,
	        onkeyup:false,
	        ignore : "",
	        rules : {
	            name : {
	                required : true
	            },
	            key : {
	                required : true
	            }
	        },
	        messages : {
	        	name : {
	                required : "请填写角色名称"
	            },
	            key : {
	                required : "请填写角色标识"
	            }
	        },
	        submitHandler : function(form) {
	        	commit('roleForm', 'role/save', 'role/listUI');
	        }
	    });
	}
		]]>
	</script>